<?php
class goods_import extends PHPUnit_Framework_TestCase{

    public function setUp()
    {
		$this->object = kernel::single('tbdata_api_tbapi');
		$this->cat_model = app::get('tbdata')->model('cats');
		$this->fetch_props_model = app::get('tbdata')->model('fetch_props');
		$this->product_model = app::get('tbdata')->model('product');
		$this->goods_model = app::get('tbdata')->model('goods');
    }

    public function testGetcat(){
		$fp = fopen('d:\1512.csv', 'r');
		$i = 0;
		    while (($data = fgetcsv($fp, 5000, ",")) !== FALSE) {
				if($i==0) {$i++;continue;}

				$save_data = array(
					'product_id'=>$data[14],
					'goods_name'=>strip_tags($data[12]),
					'keyword'=>$data[15],
					'platform'=>'taobao',
					'merchant'=>$data[6],
					'click_url'=>$data[0],
					'price'=>$data[9],
					);
				$this->goods_model->save($save_data);
				unset($save_data['id']);

				$i++;
			}

	}
}
